// 游戏配置参数
export const GAME_CONFIG = {
  // 游戏区域尺寸
  GAME_WIDTH: 360,
  GAME_HEIGHT: 640,
  
  // 鸟的尺寸和物理参数
  BIRD_WIDTH: 40,
  BIRD_HEIGHT: 30,
  BIRD_GRAVITY: 0.5,
  BIRD_JUMP_STRENGTH: -10, // 向上跳跃的力度（负值表示向上）
  BIRD_TERMINAL_VELOCITY: 15, // 最大下落速度
  // 管道参数
  PIPE_WIDTH: 60,
  PIPE_GAP: 180,
  PIPE_MIN_HEIGHT: 100,
  PIPE_SPEED: 3,
  PIPE_SPAWN_INTERVAL: 1500, // 毫秒
  
  // 游戏速度和难度
  INITIAL_SPEED: 3,
  SPEED_INCREMENT: 0.0001,
  MAX_SPEED: 6,
  
  // 地面高度
  GROUND_HEIGHT: 80,
  
  // 得分区域
  SCORE_ZONE_WIDTH: 5,
  
  // 游戏状态
  GAME_STATES: {
    READY: "ready",
    PLAYING: "playing",
    GAME_OVER: "gameOver"
  } as const,
  
  // 碰撞检测参数
  COLLISION_PADDING: 5, // 碰撞检测的宽容度
  
  // 动画参数
  BIRD_ANIMATION_DURATION: 0.6, // 秒
  BIRD_FALL_ANIMATION_DURATION: 0.5, // 秒
  
  // 本地存储键
  STORAGE_KEYS: {
    HIGH_SCORE: "flappy_bird_high_score"
  }
};

// 游戏状态类型
export type GameState = typeof GAME_CONFIG.GAME_STATES[keyof typeof GAME_CONFIG.GAME_STATES];

// 鸟的状态
export interface BirdState {
  y: number;
  velocity: number;
  rotation: number;
}

// 管道状态
export interface Pipe {
  id: number;
  x: number;
  topHeight: number;
  passed: boolean;
}

// 游戏状态
export interface GameStateData {
  state: GameState;
  bird: BirdState;
  pipes: Pipe[];
  score: number;
  highScore: number;
  speed: number;
}